Skip to content

fix(runtime): omit empty MCP args instead of writing null - #1192

Open
finallylly wants to merge 1 commit into
Tencent:mainfrom
finallylly:codex/fix-mcp-null-args
Open

finallylly wants to merge 1 commit into
Tencent:mainfrom
finallylly:codex/fix-mcp-null-args

Conversation

@finallylly

Copy link
Copy Markdown

What changed

SOP agent nodes running on Claude Code could not see the agentflow-gate MCP server, so submit_gate_result was missing. The platform resumed the CLI session, still received no gate result, and stopped every node for manual confirmation (未收到 submit_gate_result,恢复 CLI session 后仍未提交).

mcpConfigEntries wrote "args": null into mcp.json for stdio servers without arguments, such as the built-in gate server. Claude Code skips a server whose args is null instead of starting it.

The entry now omits args when it is empty, which matches how the Codex renderer (codexMCPServerArgs) already handles servers without arguments.

This addresses the same problem as #1034, which writes "args": [] instead. Either form works with Claude Code; this PR adds a reproduction on macOS and keeps the generated entry consistent with the Codex renderer. Feel free to close whichever one you do not prefer.

Scope

  • Platform core / API / runner
  • Public adapter / deployment
  • Classic
  • Portable
  • Shared behavior contract
  • Installer / CLI
  • Documentation only

Compatibility

No schema or runner protocol change. Only stdio MCP entries without arguments change: args is omitted instead of written as null. Entries with arguments are unchanged. Consumers in agent_cli.go already handle a missing args key.

Validation

Run on macOS (Apple silicon).

go test ./internal/runtime -run 'TestMCPConfigEntriesOmitsEmptyArgs|MCP|Materialize|Gate' -count=1   # pass
go vet ./internal/runtime                                                                         # pass
python3 scripts/check-public.py                                                                   # pass
  • New TestMCPConfigEntriesOmitsEmptyArgs fails without the fix ("args":null in the rendered config) and passes with it.
  • go test ./internal/runtime: the remaining failures in this macOS environment (Docker-dependent tests) are identical with and without this change.
  • Claude Code 2.1.326 and 2.1.328, with a stub model endpoint and the platform gate binary: "args": null → no MCP servers loaded, submit_gate_result absent; "args": [] or omitted → agentflow-gate connected and submit_gate_result listed.
  • End to end on a local deployment with the local sandbox: before the fix every Claude agent node stopped for manual confirmation; after it, the backend delivery SOP ran through and only stopped at the configured approval nodes.
  • Not run: full go test ./..., scripts/scan-secrets.sh (downloads a Linux-only binary), Local edition scripts (not affected).

Safety

  • I did not include credentials, internal endpoints, production data, or organization-specific infrastructure.
  • I preserved user files and unrelated changes.
  • I updated generated Classic host bundles when applicable.
  • I documented third-party content and licensing changes when applicable.

mcpConfigEntries wrote "args": null for stdio MCP servers without
arguments, such as the built-in gate server. Claude Code skips a server
whose args is null, so SOP nodes running on Claude never saw
submit_gate_result and stopped for manual confirmation.

Omit args when it is empty, matching the Codex renderer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant